package lcp;

/**
 * @author admin
 * LCP 06. 拿硬币
 * 解题思路：遍历每一个数，除以2加上模2的值即为取完一堆硬币所需次数
 */
public class LCP06 {

    public int minCount(int[] coins) {
        int res = 0;
        for (int coin : coins) {
            res = coin/2 + coin%2 + res;
        }
        return res;
    }

    public static void main(String[] args) {
        System.out.println(new LCP06().minCount(new int[]{5, 2, 1}));
    }
}
